package com.tianji.promotion.mapper;

import com.tianji.promotion.domain.po.Coupon;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 优惠券的规则信息 Mapper 接口
 * </p>
 *
 * @author lcm
 * @since 2023-08-01
 */
@Mapper
public interface CouponMapper extends BaseMapper<Coupon> {
    /**
     * 新增发放数量
     * @param id
     * @return
     */
    @Update("update coupon set issue_num=issue_num+1 where id =#{id} and issue_num < total_num ")
    int icsIssueNum(@Param("id") Long id);
}
